package com.th.config;

import com.th.util.CustomDialect;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//配置类
@Configuration
public class WebConfig implements WebMvcConfigurer {

    //注册方言，为thymleaf模板输出自定义方法结果提供支持
    @Bean
    @ConditionalOnMissingBean
    public CustomDialect customDialect(){
        return new CustomDialect("Dict Dialect");
    }

    /*//配置默认跳转
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("login");
        registry.addViewController("/login").setViewName("login");
        registry.addViewController("/index").setViewName("index");
        registry.addViewController("/items/v/add").setViewName("items-add");
    }*/

    //找不到static中的资源css和js，这是第一种方式，第二种方式在springboot配置文件里面
    /*@Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/image/**").addResourceLocations("file:E:/image/");
    }*/


}
